import csv


# 定义一个方法 解析csv文件,去掉列名,以每列的数据为一个list,外面套一层dict,key为首行列名,value为所有的当前列数据
def csv_to_columnar_dict(file_path):
    with open(file_path, 'r', encoding='utf-8') as f:
        question = []
        answer = []
        reader = csv.reader(f)
        for row in reader:
            question.append(row[0])
            answer.append(row[2])
            data = {"question": question, "answer": answer}
    return data


if __name__ == '__main__':
    data = csv_to_columnar_dict('../../CoT_zh/CoT_Chinese_data.csv')
    # 循环list
